﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Data;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;

namespace CommunitySystemModel
{
    [Serializable]
    [DataContract]
    public class Emp_SYQMKHModel
    {

        private int _ID;
         [DataMember]
        public int ID
        {
            get { return _ID; }
            set { _ID = value; }
        }
         private int _EID;
         [DataMember]
         public int EID
         {
             get { return _EID; }
             set { _EID = value; }
         }
         private string _Name;
         [DataMember]
         public string Name
         {
             get { return _Name; }
             set { _Name = value; }
         }
         private string _CardNo;
         [DataMember]
         public string CardNo
         {
             get { return _CardNo; }
             set { _CardNo = value; }
         }
         private string _TLSJ;
         [DataMember]
         public string TLSJ
         {
             get { return _TLSJ; }
             set { _TLSJ = value; }
         }
         private string _KHStatus;
         [DataMember]
         public string KHStatus
         {
             get { return _KHStatus; }
             set { _KHStatus = value; }
         }
         private string _Status;
         [DataMember]
         public string Status
         {
             get { return _Status; }
             set { _Status = value; }
         }
         private string _REbeDate;
         [DataMember]
         public string REbeDate
         {
             get { return _REbeDate; }
             set { _REbeDate = value; }
         }
         private string _DutyLevel;
         [DataMember]
         public string DutyLevel
         {
             get { return _DutyLevel; }
             set { _DutyLevel = value; }
         }
         private string _KS;
         [DataMember]
         public string KS
         {
             get { return _KS; }
             set { _KS = value; }
         }
         private string _DutyNo;
         [DataMember]
         public string DutyNo
         {
             get { return _DutyNo; }
             set { _DutyNo = value; }
         }
         private string _BHGYY;
         [DataMember]
         public string BHGYY
         {
             get { return _BHGYY; }
             set { _BHGYY = value; }
         }
         private string _SYQYSYY;
         [DataMember]
         public string SYQYSYY
         {
             get { return _SYQYSYY; }
             set { _SYQYSYY = value; }
         }
         private string _SYQYSDate;
         [DataMember]
         public string SYQYSDate
         {
             get { return _SYQYSDate; }
             set { _SYQYSDate = value; }
         }
         private string _BZ;
         [DataMember]
         public string BZ
         {
             get { return _BZ; }
             set { _BZ = value; }
         }
         private string _CreateUser;
         [DataMember]
         public string CreateUser
         {
             get { return _CreateUser; }
             set { _CreateUser = value; }
         }
         private DateTime? _CreateDate;
         [DataMember]
         public DateTime? CreateDate
         {
             get { return _CreateDate; }
             set { _CreateDate = value; }
         }
         private string _ModifiUser;
         [DataMember]
         public string ModifiUser
         {
             get { return _ModifiUser; }
             set { _ModifiUser = value; }
         }
         private string _ModifDate;
         [DataMember]
         public string ModifDate
         {
             get { return _ModifDate; }
             set { _ModifDate = value; }
         }
		private int _OrgID;
         [DataMember]
         public int OrgID
         {
             get { return _OrgID; }
             set { _OrgID = value; }
         }
         private string _OrgName;
         [DataMember]
         public string OrgName
         {
             get { return _OrgName; }
             set { _OrgName = value; }
         }
         private bool isselected = false;
         [DataMember]
         public bool IsSelected
         {
             get { return isselected; }
             set { isselected = value; }
         }
         private int _Sequence;
         [DataMember]
         public int Sequence
         {
             get { return _Sequence; }
             set { _Sequence = value; }
         }
         private string _ISZS;
         [DataMember]
         public string ISZS
         {
             get { return _ISZS; }
             set { _ISZS = value; }
         }
        
         private ObservableCollection<Emp_SYQMKHFJModel> _Attachment = new ObservableCollection<Emp_SYQMKHFJModel>();
        [DataMember]
         public ObservableCollection<Emp_SYQMKHFJModel> Attachment
        {
            get { return _Attachment; }
            set { _Attachment = value; }
        }

        public static Emp_SYQMKHModel FillEntity(DataRow dr)
        {
            Emp_SYQMKHModel right = new Emp_SYQMKHModel();
            right.IsSelected = dr["IsSelected"].ToString() == "false" ? false : true;
            right.Sequence = Convert.ToInt32(dr["Sequence"]);
            if (dr.Table != null && dr.Table.Columns.Contains("ID")) right.ID = Convert.ToInt32(dr["ID"]);
            if (dr.Table != null && dr.Table.Columns.Contains("EID")) right.EID = Convert.ToInt32(dr["EID"]);
            if (dr.Table != null && dr.Table.Columns.Contains("Name")) if (!string.IsNullOrEmpty(dr["Name"].ToString())) right.Name = dr["Name"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("CardNo")) if (!string.IsNullOrEmpty(dr["CardNo"].ToString())) right.CardNo = dr["CardNo"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("TLSJ")) if (!string.IsNullOrEmpty(dr["TLSJ"].ToString())) right.TLSJ = dr["TLSJ"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("KHStatus")) if (!string.IsNullOrEmpty(dr["KHStatus"].ToString())) right.KHStatus = dr["KHStatus"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("OrgID")) right.OrgID = Convert.ToInt32(dr["OrgID"]);
            if (dr.Table != null && dr.Table.Columns.Contains("OrgName")) if (!string.IsNullOrEmpty(dr["OrgName"].ToString())) right.OrgName = dr["OrgName"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("Status")) if (!string.IsNullOrEmpty(dr["Status"].ToString())) right.Status = dr["Status"].ToString();

            if (dr.Table != null && dr.Table.Columns.Contains("REbeDate")) if (!string.IsNullOrEmpty(dr["REbeDate"].ToString()) && Convert.ToDateTime(dr["REbeDate"].ToString()).Year!=1900) right.REbeDate = Convert.ToDateTime(dr["REbeDate"].ToString()).ToString("yyyy-MM-dd");
            if (dr.Table != null && dr.Table.Columns.Contains("DutyLevel")) if (!string.IsNullOrEmpty(dr["DutyLevel"].ToString())) right.DutyLevel = dr["DutyLevel"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("KS")) if (!string.IsNullOrEmpty(dr["KS"].ToString())) right.KS = dr["KS"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("DutyNo")) if (!string.IsNullOrEmpty(dr["DutyNo"].ToString())) right.DutyNo = dr["DutyNo"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("BHGYY")) if (!string.IsNullOrEmpty(dr["BHGYY"].ToString())) right.BHGYY = dr["BHGYY"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("SYQYSYY")) if (!string.IsNullOrEmpty(dr["SYQYSYY"].ToString())) right.SYQYSYY = dr["SYQYSYY"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("SYQYSDate")) if (!string.IsNullOrEmpty(dr["SYQYSDate"].ToString())) right.SYQYSDate = dr["SYQYSDate"].ToString();

            if (dr.Table != null && dr.Table.Columns.Contains("BZ")) if (!string.IsNullOrEmpty(dr["BZ"].ToString())) right.BZ = dr["BZ"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("ISZS")) if (!string.IsNullOrEmpty(dr["ISZS"].ToString())) right.ISZS = dr["ISZS"].ToString();
            return right;
        }
    }
}
